package com.xxx.ssoclient2.redistype;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.awt.print.Book;

@RestController
public class BookController {

    @GetMapping("/testRedisLock")
    @RedisLockAnnotation(typeEnum = RedisLockTypeEnum.ONE, lockTime = 3)
    public Book testRedisLock(@RequestParam("userId") Long userId){
        try {
            System.out.println("睡眠执行前");
            Thread.sleep(10000);
            System.out.println("睡眠执行后");
        } catch (Exception e) {
            System.out.println("has some error");
        }
        return null;
    }
}
